watch: {
    '$route.params.categoryId': function () {
      this.fetchProducts();
    }
  },
  mounted() {
    this.fetchProducts();
  },
  methods: {
    fetchProducts() {
      this.categoryId = this.$route.params.categoryId;
      this.products = [
        {
          id: 1,
          name: `分类ID为${this.categoryId}的商品-1`,
          price: '￥100',
          image: 'https://via.placeholder.com/150'
        },
        {
          id: 2,
          name: `分类ID为${this.categoryId}的商品-2`,
          price: '￥200',
          image: 'https://via.placeholder.com/150'
        }
      ];
    },
    addToCart(product) {
      alert(`添加 ${product.name} 到购物车!`);
    }
  }